import wx
from Constant import *
'''
PopUpMenu : define pop-up menu of clicking right key on mouse
'''
class PopUpMenu(wx.Menu):
    '''
    Constructor : PopUpMenu
    '''
    def __init__(self, menuList):
        wx.Menu.__init__(self)
        self._001_createMenuItem(menuList)
    '''
    function _001 : create item of popup menu
    '''
    def _001_createMenuItem(self, menuList):
        for menuType, text, bindMethod in menuList :
            if menuType != MENU_TYPE_SEPERATOR :
                if menuType == MENU_TYPE_COMMON :
                    item = self.Append(-1, text)
                elif menuType == MENU_TYPE_CHECK :
                    item = self.AppendCheckItem(-1, text)
                self.Bind(wx.EVT_MENU, bindMethod, item)
            else :
                self.AppendSeparator()